package com.venutech.gongan.service;

import com.baomidou.mybatisplus.plugins.Page;
import com.venutech.gongan.entity.Work;
import com.venutech.gongan.vo.*;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * 工单服务接口
 */
public interface WorkService {
    //工单添加
    int insert(Work work);
    //根据ID返回对象
    Work getById(Integer wk_id);

    WorkInfoDto getWorkInfo(int workId);

    WorkInfoDto getPatrolWorkInfo(int workId);
    //分页查询
//    Page<Work> getInfo(Integer pageNo, Integer pageSize, String begintime, String endtime,
//                       Integer wk_type);

    Page<WorkInfoDto> getWorkInfoList(Integer pageNo, Integer pageSize, String begintime, String endtime, Integer wk_type, String poleName, Integer workStatus);

    Page<WorkInfoDto> getPatrolWorkInfoList(Integer pageNo, Integer pageSize, String poleName);

    //我的工单==》历史查询
    Page<Work> getInfo2(Integer pageNo, Integer pageSize, String begintime, String endtime,
                        Integer wk_type, Integer user_id);

    //我的工单==》待审批查询
    Page<Work> getInfo3(Integer pageNo, Integer pageSize, String begintime, String endtime,
                        Integer wk_type, Integer user_id);

    //查询所有工单Excel导出
    List<Work> getAllWorks(Integer userId, Integer wk_type);

    //查询今日工单报表数据-Count
    Integer getSelCountByDay();

    Integer getTotalCount();

    //查詢我的历史工单
    Integer getSelCountByUser(Integer user_id);

    Integer getTotalCountByUser(Integer user_id);


    //根据当前用户查询本周工单报表数据-导出Excel
    List<Work> getSelByWeek(@Param("user_id") Integer user_id);

    //查询本周工单报表数据-Count
    Integer getSelCountByWeek(@Param("user_id") Integer user_id);

    //根据当前用户查询本月工单报表数据-导出Excel
    List<Work> getSelByMonth(@Param("user_id") Integer user_id);

    //查询本月工单报表数据-Count
    Integer getSelCountByMonth(@Param("user_id") Integer user_id);

    //API
    //工单添加Dto
    int insertWorkDto(WorkDto work);

    int createVideoPrivilegeWork(SpGrantDto spGrantDto);

    //外网工单添加Dto
    int insertWorkExtDto(WorkExtDto workExtDto);

    //查询用户提交的工单信息
    List<Work> getWorkDtoList(Integer userId, Integer workType, String startTime, String endTime);

    List<Work> getWorkDtoList(Integer userId, Integer workType, Integer pageNo, Integer pageSize);

    //巡检打卡
    int poleWorkDto(WorkDto work);

    int getCountByTypeAndDay(int workType, Date startDay);

    int getCountByType(int workType);

    List<Work> getByTypeAndDateRange(int workType, Date startDate, Date endDate);

    /**
     * 未绑定的设备数
     * @return
     */
    int getSelectUnBindCount();

    /**
     *
     * @param v
     * @return
     */
    int insertOperation(Operation v);

    Page<Operation> selectOperationList(Integer page, Integer limit, Integer work_device_type);

    Operation getOperationById(Operation v);

    List<Work> getWorkByUserid(Integer userId, String sTime, String eTime);

    void approveWork(int workId, int userId);

    void approveVideoPrivilegeWork(int workId, int spUserId);

    void declineVideoPrivilegeWork(int workId, int spUserId);

    int updateSpUser(int workId, int spUserId);

    WorkInfoDto assembleWorkInfoDto(Work work);

    int updateWork(Integer workId, int user_id);
}
